[Fix] Guard likely owner commit links#52
Open
samzong wants to merge 1 commit intoopenclaw:mainfrom
Open
Conversation
Signed-off-by: samzong <samzong.lu@gmail.com>
ds4psb-ai
reviewed
May 8, 2026
ds4psb-ai
left a comment
There was a problem hiding this comment.
Independent code review
Posted on behalf of @ds4psb-ai (read-only contributor). Maintainer judgment owns merge.
Summary verdict
LGTM — small, surgical, evidence-backed fix; no blockers.
Findings
P0 / blocker
- (none)
P1 / should fix before merge
- (none)
P2 / nice to have / followup
src/clawsweeper.ts:3609isCommitSha— the regex/^[0-9a-f]{7,40}$/iis correct, but the existingreportLikelyOwnersparser atsrc/clawsweeper.ts:4313-4319already trims commits when reading them out of stored markdown. The new.map(commit => commit.trim())is therefore redundant for the persisted-then-rendered path, but is necessary for the freshly-decided path (object straight from Codex JSON). Worth a one-line code comment so future readers don't strip the trim on the assumption it's dead code.src/clawsweeper.ts:4097-4101— consider also dropping owners whose entirecommitsarray filters to empty after the SHA gate (currently they still render with nocommits:suffix, which is the correct/safe behavior — flagging only because the PR description focuses on URL noise and you may want symmetry with how emptyfilesis handled). Not blocking.
Test coverage
The single new test at test/clawsweeper.test.ts:629-652 does cover the mixed-provenance case the PR body claims (one URL + one valid SHA, with whitespace padding on the SHA), and asserts both negatives (no /commit/https: substring) and positives (the well-formed link). Good shape. Two coverage gaps worth considering (P2):
- A pure-noise input:
commits: ["#23580", "PR #67960"]— should produce a line with nocommits:suffix at all. This is the exact pattern from the issue 72080 and PR 71158 evidence URLs in the description. - Uppercase-hex SHA acceptance — the regex uses the
iflag and your isCommitSha unit-tests aren't exposed; one round-trip case would lock that in.
Neither is blocking; the existing test catches the production regression class.
Risks I considered and dismissed
- False negatives on real short SHAs: regex floor of 7 matches GitHub's own short-SHA convention, no risk.
- Truncated 6-char SHAs from older Codex output: searched
src/clawsweeper.tsforshortSha(callers — nothing emits a 6-char value back into a likelyOwner commits field, so the 7-char floor is safe. - Unicode / smart-quote variants of
PR #...: not produced by Codex; not in the evidence URLs. - Production evidence still broken: spot-checked openclaw/openclaw#72080 (still renders
/commit/#23580as a link) and openclaw/openclaw#71158 (still renders/commit/PRlinks) — confirms the fix isn't already obsoleted by something else.
Nice catch on the trim — many "filter Boolean" guards miss whitespace-only strings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What's changed?
Likely related people.Why
ClawSweeper public comments can receive non-SHA provenance strings in
likelyOwners[].commits. Before this change, those values were passed directly to the commit-link renderer, producing invalid GitHub commit URLs in visible comments.Evidence from existing public ClawSweeper comments:
/commit/https://github.com/openclaw/openclaw/pull/76079.#23580as/commit/#23580.#73046and#727as commit links.PR #67960as/commit/PR #67960.PR #...entries as commit links.PR #64713,PR #67642, andPR #67704as commit links.Validation
pnpm run check/pre-ship --committed: 0 MUST-FIX findings, no deferred findings